﻿// ClockPropPage.cpp : CClockPropPage 属性页类的实现。

#include "pch.h"
#include "framework.h"
#include "Clock.h"
#include "ClockPropPage.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

IMPLEMENT_DYNCREATE(CClockPropPage, COlePropertyPage)

// 消息映射

BEGIN_MESSAGE_MAP(CClockPropPage, COlePropertyPage)
	ON_EN_CHANGE(IDC_EDIT1, &CClockPropPage::OnEnChangeEdit1)
END_MESSAGE_MAP()

// 初始化类工厂和 guid

IMPLEMENT_OLECREATE_EX(CClockPropPage, "MFCACTIVEXCONT.ClockPropPage.1",
	0xd5dca9c0, 0x4515, 0x4e22, 0x93, 0xe1, 0xab, 0x66, 0xcf, 0x9e, 0x48, 0xbe)

	// CClockPropPage::CClockPropPageFactory::UpdateRegistry -
	// 添加或移除 CClockPropPage 的系统注册表项

	BOOL CClockPropPage::CClockPropPageFactory::UpdateRegistry(BOOL bRegister)
{
	if (bRegister)
		return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
			m_clsid, IDS_CLOCK_PPG);
	else
		return AfxOleUnregisterClass(m_clsid, nullptr);
}

// CClockPropPage::CClockPropPage - 构造函数

CClockPropPage::CClockPropPage() :
	COlePropertyPage(IDD, IDS_CLOCK_PPG_CAPTION)
	, Interval(0)
	, m_updateInterval(0)
{
}

// CClockPropPage::DoDataExchange - 在页和属性间移动数据

void CClockPropPage::DoDataExchange(CDataExchange* pDX)
{
	DDP_PostProcessing(pDX);
	//  DDX_Text(pDX, IDC_EDIT_Interval, Interval);
	DDP_Text(pDX, IDC_EDIT_Interval, m_updateInterval, _T("Interval"));// 关联属性
	DDX_Text(pDX, IDC_EDIT_Interval, m_updateInterval);
}

// CClockPropPage 消息处理程序


void CClockPropPage::OnEnChangeEdit1()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 COlePropertyPage::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码
}
